﻿@using Orchard.AuditTrail.Helpers
@using Orchard.AuditTrail.Models
@using Orchard.ContentManagement
@{
    var record = (AuditTrailEventRecord)Model.Record;
    var eventData = (IDictionary<string, object>) Model.EventData;
    var versionNumber = eventData.Get<int>("VersionNumber");
    var contentItem = (ContentItem) Model.ContentItem;
}
<ul class="action-links">
    <li class="action-link">
        @Html.ActionLink(T("Details").Text, "Detail", "Admin", new { id = record.Id, area = "Orchard.AuditTrail" }, null)
    </li>
    @if (contentItem != null) {
        var isLatest = contentItem.VersionRecord.Number == versionNumber;
        if (!isLatest) {
            <li class="action-link">
                @Html.ActionLink(T("Restore").Text, "Restore", "Content", new { id = contentItem.Id, version = versionNumber, area = "Orchard.AuditTrail" }, new { data_unsafe_url = T("Are you sure you want to restore to version {0}?", versionNumber) })
            </li>
        }
    }
</ul>